<?php
/*
 *  @author Nicolas Genevaux
 * (c)nige 2008
 */
	include($RACINE.'inc/sql.exercice.php');
	include($RACINE.'inc/sql.exercicechoix.php');
	include($RACINE.'inc/sql.inscrit.php');
	$IDMATIERE = $_GET['idmat'];
	include($RACINE.'inc/var.points.php');
	if($_POST['valider']) {
		$res = doSQL($EXERCICE_SELECT_INMAEX,array(0=>$_POST['idex'],1=>$_POST['idmat'],2=>$_SESSION['ID_CONECT']));
		if($res['total']==1) {
			if($_POST['accept']==1) {
				doSQL($INSCRIT_POINTS,array(0=>$_SESSION['ID_CONECT'],1=>'('.(-1*$QUESTIONS).')'));
				doSQL($EXERCICE_DELETE,array(0=>$_POST['idex']));
				doSQL($EXERCICECHOIX_DELETE,array(0=>$_POST['idex']));
			}
			redirect($PAGE_LISTE_QUESTION.'?idmat='.$_POST['idmat']);
		}
		else {
			redirect($PAGE_ACCUEIL_INSCRIT);
		}
	}
	else {
		include($RACINE.'texte/question_suppriquestions.php');
	}
?>
